
import logging
from dice import *
from world import CoordinatePlane

class Island(CoordinatePlane):
    """Represents an island. Coordinates, etc. handled by inheritance."""
    x = 0
    y = 0
    pirates = {}
    bounds = None
    maxPirates = None
    treasureDice = None
    logger = logging.getLogger('pgame.engine.PirateGame.island')
    def __init__(self, bounds, treasureRoll=dice1d6, maxPirates=-1):
        self.bounds = bounds
        self.treasureDice = treasureRoll
        self.maxPirates = maxPirates
        self.pirates = {}
        
    def findTreasure(self, pirate):
        self.logger.debug("Attempted to find treasure.")
        if self.treasureDice.roll() == 1:
            return True
        else:
            return False

class StoryIsland(Island):
    """
    Represents an island. Unlike Island, StoryIsland supports actions based on
    position.
    """
    triggers = {}
    
    def __init__(self, bounds, treasureRoll=dice1d6,
                       maxPirates=-1, triggers=None):
        Island.__init__(self, foliage, treasureRoll, maxPirates)
        self.triggers = triggers
        #TODO: Finish construction
        pass
    
    def moveItem(self, item):
        #TODO: Implement setting off triggers
        pass
    